package com.sctvcloud.dongqu.ui.adapter.holder;

import android.content.Context;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.widget.ImageView;

import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.ruihang.generalibrary.ui.adapter.holder.BaseRecylerHolder;
import com.ruihang.generalibrary.ui.widget.CustomEXImageView;
import com.ruihang.generalibrary.ui.widget.CustomFontTextView;
import com.ruihang.generalibrary.utils.DateUtils;
import com.sctvcloud.dongqu.R;
import com.sctvcloud.dongqu.beans.FCityState;
import com.sctvcloud.dongqu.ui.activities.ShareDetailActivity;
import com.sctvcloud.dongqu.ui.adapter.CommonFrgAdapter;
import com.sctvcloud.dongqu.ui.utils.GlideCircleTransform;
import com.sctvcloud.dongqu.ui.utils.GlideUtil;
import com.sctvcloud.dongqu.ui.utils.UIUtils;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * Created by Administrator on 2017/6/23 0023.
 */

public class BumenFrgHolder extends BaseRecylerHolder<FCityState> implements View.OnClickListener {

    @BindView(R.id.iv_pic)
    protected CustomEXImageView iv_pic;

    @BindView(R.id.tv_name)
    protected CustomFontTextView tv_name;

    private FCityState mFCityState;

    private Context context;

    public BumenFrgHolder(Context context, View itemView) {
        super(context, itemView);
        itemView.setOnClickListener(this);
        this.context = context;
    }

    @Override
    protected void initInject() {
        ButterKnife.bind(this, itemView);
    }

    @Override
    public void setData(FCityState FCityState) {
        mFCityState = FCityState;
        if(!TextUtils.isEmpty(FCityState.getInstitutionName())){
            tv_name.setText(FCityState.getInstitutionName());
        }

        if(!TextUtils.isEmpty(FCityState.getInstitutionImage())){
            GlideUtil.getGlid(context, FCityState.getInstitutionImage()).skipMemoryCache(true)
                    .diskCacheStrategy(DiskCacheStrategy.NONE).error(R.mipmap.icon_def_1_1)
                    .placeholder(R.mipmap.icon_def_1_1).transform(new GlideCircleTransform(context))
                    .into(iv_pic);
        }

    }

    @Override
    public void onClick(View v) {
        if (internalClick != null) {
            itemView.setTag(R.id.adapter_item_data_key, mFCityState);
            internalClick.onItemInternalClick(itemView, v, getAdapterPosition());
        }
    }
}
